package com.xuhuan.admin.service.user.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xuhuan.admin.entity.User;
import com.xuhuan.admin.mapper.UserMapper;
import com.xuhuan.admin.service.user.UserService;
import org.springframework.stereotype.Service;

/**
 * @author: huan.xu
 * @create: 2024/6/10 15:56
 * @description: 用户service接口实现
 **/
@Service
public class UserServiceImpl extends
    ServiceImpl<UserMapper, User> implements UserService {

  /**
   * 根据用户名查询用户
   *
   * @param userName
   * @return
   */
  @Override
  public User getUserByUserName(String userName) {
    LambdaQueryWrapper<User> lambdaQuery = Wrappers.lambdaQuery();
    lambdaQuery.eq(User::getUsername, userName);
    return baseMapper.selectOne(lambdaQuery);
  }

}
